/* Input a number. 
Convert the number into words using functions and regular expressions in Perl. Do not use parse functions.(15 => one five)
*/

#include<iostream.h>
#include<conio.h>

void printChar(int digit)
{
     switch(digit)
     {
          case 0:
               cout<<" zero";
               break;
          case 1:
               cout<<" one";
               break;
          case 2:
               cout<<" two";
               break;
          case 3:
               cout<<" three";
               break;
          case 4:
               cout<<" four";
               break;
          case 5:
               cout<<" five";
               break;
          case 6:
               cout<<" six";
               break;
          case 7:
               cout<<" seven";
               break;
          case 8:
               cout<<" eight";
               break;
          case 9:
               cout<<" nine";
               break;
          default :
                  cout<<" unknown error";
                  break;
     }
}

void printAsChar(int num)
{
     int i=0,remainder[8],digit;
     while(num > 0)
     {
          remainder[i] = num % 10;
          i++;
          num = num / 10;
     }
     while(i > 0)
     {
          digit = remainder[--i];
          printChar(digit);
     }
}
int main()
{
    int num;
    cout<<"\nEnter the number ";
    cin>> num;
    printAsChar(num);
    getch();
    return 0;
}
